<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Route::get('/','AuthController@login')->name('admin.login');

Route::group(['middleware' => 'admin'], function ($r) {

    /**
     * @var $r Route
     */
    $r->group(['prefix' => 'auth'], function ($r){
        /**
         * @var $r Route
         */
        //登录
        $r->any('login', 'AuthController@login')->name('admin.login')->withoutMiddleware('admin');
        //登出
        $r->get('logout', 'AuthController@logout');
        //管理员列表
        $r->get('manager-list', 'AuthController@managerList');
        //修改管理员
        $r->any('edit-manager', 'AuthController@editManager');
        //删除管理员
        $r->post('delete-manager', 'AuthController@deleteManager');
        //权限组列表
        $r->get('group-list', 'AuthController@groupList');
        //修改权限组
        $r->any('edit-group', 'AuthController@editGroup');
        //获取权限菜单
        $r->post('group-tree', 'AuthController@getGroupTree');
        //删除权限组
        $r->post('delete-group', 'AuthController@deleteGroup');
        //修改密码
        $r->any('edit-password', 'AuthController@editPassword');

    });

    $r->group(['prefix' => 'banner'], function ($r){
        /**
         * @var $r Route
         */
        //幻灯片列表
        $r->get('banner-list', 'BannerController@bannerList');
        //添加幻灯片
        $r->any('edit-banner', 'BannerController@editBanner');
        //删除幻灯片
        $r->post('delete-banner', 'BannerController@deleteBanner');

    });

    $r->group(['prefix' => 'public'], function ($r){
        /**
         * @var $r Route
         */
        //主页
        $r->any('home', 'PublicController@home')->name('admin.home');
        //控制台
        $r->any('console', 'PublicController@console');
        //系统管理
        $r->any('setting', 'PublicController@setting');
        //幻灯片管理
        $r->get('banner', 'PublicController@banner');
        //layui富文本上传图片
        $r->post('lay-upload', 'PublicController@layUpload');

    });


    $r->group(['prefix' => 'goods'], function ($r){
        /**
         * @var $r Route
         */
        //商品列表
        $r->get('goods-list', 'GoodsController@goodsList');
        //编辑商品
        $r->any('edit-goods', 'GoodsController@editGoods');
        //编辑商品文件
        $r->any('edit-file/{id}', 'GoodsController@editFiles');
        //库存记录
        $r->get('stock-log/{id}', 'GoodsController@getStockLogList');
        //删除商品
        $r->post('delete-goods', 'GoodsController@deleteGoods');
        //分类列表
        $r->get('category-list', 'GoodsController@categoryList');
        //编辑分类
        $r->any('edit-category', 'GoodsController@editCategory');
        //获取分类树
        $r->post('category-tree', 'GoodsController@getCategoryTree');
        //删除分类
        $r->post('delete-category', 'GoodsController@deleteCategory');
        //品牌列表
        $r->get('branch-list', 'GoodsController@branchList');
        //编辑品牌
        $r->any('edit-branch', 'GoodsController@editBranch');
        //删除品牌
        $r->post('delete-branch', 'GoodsController@deleteBranch');
    });

    $r->group(['prefix' => 'sku'], function ($r) {
        /**
         * @var $r Route
         */
        //规格列表
        $r->get('list', 'SkuController@skuList');
        //编辑分类sku
        $r->any('edit', 'SkuController@edit');
        //删除分类sku
        $r->post('delete', 'SkuController@delete');
        //详情
        $r->post('detail', 'SkuController@detail');
    });

    $r->group(['prefix' => 'article'], function ($r) {
        /**
         * @var $r Route
         */
        //文章列表
        $r->get('article-list', 'ArticleController@articleList');
        //编辑文章
        $r->any('edit-article', 'ArticleController@editArticle');
    });


    $r->group(['prefix' => 'user'], function ($r) {
        /**
         * @var $r Route
         */
        //会员列表
        $r->get('user-list', 'UsersController@userList');
        //会员等级
        $r->get('level', 'UsersController@level');
        //用户流水记录
        $r->get('balance-log/{uid}', 'UsersController@balanceLog');
        //用户详情
        $r->get('detail/{uid}', 'UsersController@detail');

    });


    $r->group(['prefix' => 'store'], function ($r) {
        /**
         * @var $r Route
         */
        //快递信息
        $r->get('express', 'StoreController@express');
        //状态快递状态
        $r->post('express-edit', 'StoreController@expressEdit');

    });

    $r->group(['prefix' => 'config'], function ($r) {
        /**
         * @var $r Route
         */
        //系统配置
        $r->any('index', 'ConfigController@index');

    });


    $r->group(['prefix' => 'order'], function ($r) {
        /**
         * @var $r Route
         */
        //订单列表
        $r->get('order-list', 'OrderController@orderList');
        //订单详情
        $r->any('detail', 'OrderController@orderDetail');
        //订单发货
        $r->any('deliver', 'OrderController@deliver');
        //更新物流信息
        $r->post('update-express', 'OrderController@updateExpress');
        //合伙人订单列表
        $r->get('partner-list', 'OrderController@partnerList');

    });

    $r->group(['prefix' => 'plugin'], function ($r) {
        /**
         * @var $r Route
         */
        //插件库
        $r->get('index', 'PluginController@index');
        //安装插件
        $r->post('install', 'PluginController@install');
        //编辑
        $r->any('edit', 'PluginController@edit');


    });



    $r->group(['prefix' => 'platform'], function ($r) {
        /**
         * @var $r Route
         */
        //平台信息
        $r->any('index', 'PlatFormController@index');


    });
});